<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var a = [];

    // 1.基于instanceof
    a instanceof Array;

    //2.基于constructor

    a.constructor === Array;

    //3.基于Object.prototype.isPrototypeof
    Array.prototype.isPrototypeOf(A);

    // 4.基于getPrototypeOf

    Object.getPrototypeOf(a) === Array.prototype;

    // 5.基于Object.prototype.toString
    Object.prototype.toString.apply(a) === '[object Array]';

    if (!Array.isArray) {
      Array.isArray = function (arg) {
        return Object.prototype.toString.call(arg) === '[object Array]';
      };
    }
  </script>
</html>
